<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	template="../template/template.xhtml">

	<ui:define name="body">
		<f:view>
			<h:form>
				<rich:panel>
					<f:facet name="header">
						<h:outputText value="Lista de Categorias" />
					</f:facet>
					
					<!-- filtros -->
					<rich:toolBar height="34" itemSeparator="line">
						<rich:toolBarGroup>
							<h:outputLabel value="Nome:" />
							<h:inputText id="nome" value="#{categoriaController.categoria.nome}" />	
						</rich:toolBarGroup>
						
						<rich:toolBarGroup location="right" style="width:180px;">
							<h:commandButton value="Consultar" action="#{categoriaController.buscarCategorias}" />
						</rich:toolBarGroup>
					</rich:toolBar>
		
					<br/>
							
					<!-- lista -->
					<rich:dataTable value="#{categoriaController.categorias}" binding="#{categoriaController.dataTable}" var="categoria" width="100%">
						<rich:column width="20%">
							<f:facet name="header">
								<h:outputLabel value="Nome" />
							</f:facet>
							<h:outputText value="#{categoria.nome}" />
						</rich:column>
					
						<rich:column width="70%">
							<f:facet name="header">
								<h:outputLabel value="Descricao" />
							</f:facet>
							<h:outputText value="#{categoria.descricao}" />
						</rich:column>
						
						<rich:column width="10%">
							<f:facet name="header">
								<h:outputLabel value="Acoes" />
							</f:facet>
							<a4j:commandButton value="Editar" action="#{categoriaController.editarCategoria}" />
						</rich:column>
					</rich:dataTable>
				</rich:panel>
				
				<br/>
		            
		        <div align="center" style="width: 100%;"><h:outputText id="message" style="color: red;" value="#{categoriaController.message}"/></div>
		            
		        <br/>				
				
			</h:form>
		</f:view>
	</ui:define>

</ui:composition>
